# Maintainer: Andrew Chadwick <a.t.chadwick@gmail.com>

_realname=mypaint
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.2.0_beta.0
pkgrel=1
arch=('any')
pkgdesc="Simple drawing & painting program that works well with Wacom-style graphics tablets"
depends=(
    "${MINGW_PACKAGE_PREFIX}-gtk3"
    "${MINGW_PACKAGE_PREFIX}-python2-numpy"
    "${MINGW_PACKAGE_PREFIX}-json-c"
    "${MINGW_PACKAGE_PREFIX}-lcms2"
    "${MINGW_PACKAGE_PREFIX}-python2-cairo"
    "${MINGW_PACKAGE_PREFIX}-python2-gobject"
    "${MINGW_PACKAGE_PREFIX}-adwaita-icon-theme"
    "${MINGW_PACKAGE_PREFIX}-librsvg"
    "${MINGW_PACKAGE_PREFIX}-gcc-libs"
    "${MINGW_PACKAGE_PREFIX}-gsettings-desktop-schemas"
    "${MINGW_PACKAGE_PREFIX}-hicolor-icon-theme"
)
makedepends=(
    "${MINGW_PACKAGE_PREFIX}-swig"
    "${MINGW_PACKAGE_PREFIX}-pkg-config"
    "${MINGW_PACKAGE_PREFIX}-pygobject-devel"
    "scons"
    "swig"
)
options=('strip' '!debug' 'staticlibs')
license=("GPL2" "ISC")
url="http://mypaint.org"
install=mypaint-${CARCH}.install
source=(https://github.com/mypaint/mypaint/releases/download/v${pkgver/_/-}/mypaint-${pkgver/_/-}.tar.xz)
sha256sums=('7a76e2f309da1ec7b41e7ef9a443a376cbb79e0edbfbebc5954b63148c30c6b1')

prepare() {
    cd "${srcdir}"/${_realname}-${pkgver/_/-}
}

build() {
    cd "${srcdir}"/${_realname}-${pkgver/_/-}
    echo "prefix: ${MINGW_PREFIX}"
    scons prefix="${MINGW_PREFIX}"
}

package() {
    cd "${srcdir}"/${_realname}-${pkgver/_/-}
    echo "prefix: ${MINGW_PREFIX}"
    echo "sandbox: ${pkgdir}"
    echo "target: ${pkgdir}${MINGW_PREFIX}"
    scons prefix="${MINGW_PREFIX}" --install-sandbox="${pkgdir}" \
        "${pkgdir}${MINGW_PREFIX}"
    install -Dm644 COPYING \
        "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING.mypaint"
    install -Dm644 brushlib/COPYING \
        "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING.libmypaint"
    install -Dm644 LICENSE \
        "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
